package com.anli1.ExceptionHandler;

import com.anli1.entity.vo.R;
import com.anli1.exception.BusinessException;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExceptionHandler {
    @org.springframework.web.bind.annotation.ExceptionHandler(value = Exception.class)
    public R handleException(Exception e)
    {
        System.out.println(e.getMessage());

        return  R.error("对不起,操作失败,请联系管理员");
    }
    @org.springframework.web.bind.annotation.ExceptionHandler(value = BusinessException.class)
    public R handleException(BusinessException e)
    {

        return  R.error( e.getMessage());
    }
}
